<?php

/**
 * AcreditacionCiudad form.
 *
 * @package    BecArTe
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class AcreditacionCiudadForm extends BaseAcreditacionCiudadForm
{
  /**
   * @see AcreditacionForm
   */
  public function configure()
  {
    parent::configure();
    $this->widgetSchema['ciudad_id']->setOption('order_by', array('nombre', 'ASC'));
  }
  
  protected function getUsefullFields()
  {
	  return array_merge(parent::getUsefullFields(), array('ciudad_id') );
  }
  
  protected function setupInheritance()
  {
    parent::setupInheritance();
    $this->configurarWidget('ciudad_id');
    $this->widgetSchema['ciudad_id'] = new sfWidgetFormDoctrineChoice(array(
      'multiple' => false,
      'add_empty' => $this->isNew() ,
      'model' => 'Ciudad'
    ));
    $this->validatorSchema['ciudad_id'] = new sfValidatorDoctrineChoice(array(
      'multiple' => false,
      'model' => 'Ciudad',
      'required' => false
    ));
  }
  
  public function estaVacio()
  {
    return 0 == ($this->isbound() ? $this->getValue('ciudad_id') : $this->getObject()->getCiudadId() ) ;
  }
  
}
